package com.ewili.x.special.dao.inter;

import com.ewili.x.special.entity.GoodWill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;

/**
 * @author wonder
 */
public interface GoodWillDao extends JpaRepository<GoodWill, Long> {

    boolean existsByCodeAndReportDate(String code, Date reportDate);

    @Query(value = "select count(1) from(select code, good_will_net_asset_rate, publish_date from good_will where code=?1 ORDER BY publish_date desc limit 1) a where a.good_will_net_asset_rate>=0.3", nativeQuery = true)
    double highGoodWill(String code);
}
